package com.ihr360.payroll.model.dto.salary.task.period.embeddable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;

@Embeddable
public class StaffSalaryTermId implements Serializable {
    @Column(name = "term_id")
    private Long termId;

    @Column(length = 40, nullable = false)
    private String staffId;

    public StaffSalaryTermId() {
    }

    public StaffSalaryTermId(Long termId, String staffId) {
        this.termId = termId;
        this.staffId = staffId;
    }

    public String getStaffId() {
        return staffId;
    }

    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }

    public Long getTermId() {
        return termId;
    }

    public void setTermId(Long termId) {
        this.termId = termId;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        StaffSalaryTermId other = (StaffSalaryTermId) obj;
        if (termId == null) {
            if (other.termId != null) {
                return false;
            }
        } else if (!termId.equals(other.termId)) {
            return false;
        }

        if (staffId == null) {
            if (other.staffId != null) {
                return false;
            }
        } else if (!staffId.equals(other.staffId)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((termId != null) ? termId.hashCode() : 0);
        result = prime * result + ((staffId != null) ? staffId.hashCode() : 0);
        return result;
    }
}